home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MACD 5
/
MACD 5.bin
/
workbench
/
libs
/
newlooklib.lha
/
newlook
/
addgtext.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-24
|
924b
|
43 lines
/*
* ADDGTEXT.C
*/
#include "newlook.h"
extern struct TextFont *OpenFont(struct TextAttr *);
extern void CloseFont(struct TextFont *);
extern LONG IntuiTextLength(struct IntuiText *);
struct IntuiText *AddGText(g,l,r)
struct Gadget *g;
STRPTR l,r;
{
struct IntuiText *it= (struct IntuiText *)NULL;
struct TextFont *tf;
SHORT tx, ty; /* text position */
tx= ( (g->GadgetType == STRGADGET) ? 14:10 );
if(tf= (struct TextFont *)OpenFont(&Topaz80))
{ ty= (g->Height-tf->tf_Baseline)/2;
CloseFont(tf);
}
else ty= (g->Height-6)/2; /* `known' topaz80 dimensions */
if(l && *l)
{ if(it= CreateIText(-tx,ty,l))
{ MoveIText(it,-IntuiTextLength(LastIText(it)),0);
LastIText(it)->NextText= g->GadgetText;
g->GadgetText= it;
}
}
if(r && *r)
{ if(it= CreateIText(g->Width+tx,ty,r))
{ LastIText(it)->NextText= g->GadgetText;
g->GadgetText= it;
}
}
return it;
}